package org.makcro.sms.services.chat.model;

import java.io.Serializable;
import javax.persistence.*;

import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;

/**
 * The persistent class for the Question database table.
 * 
 */
@Entity
@Table(name = "question")
@NamedQueries({ @NamedQuery(name = "Question.findUnassigned", query = "SELECT q FROM Question q WHERE q.questionResponsibilities IS EMPTY AND q.visable = true"),
		@NamedQuery(name = "Question.findByCoreId", query = "SELECT q FROM Question q WHERE q.coreID = :coreId") })
public class Question implements Serializable {
	private static final long			serialVersionUID	= 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "QuestionID")
	private int							questionID;

	@Column(name = "CoreID")
	private Long						coreID;

	@Column(name = "DateReceived")
	@Temporal(TemporalType.TIMESTAMP)
	private Date						dateReceived;

	@Column(name = "FromNumber")
	private String						fromNumber;

	@Column(name = "Question")
	private String						question;

	@Column(name = "ToNumber")
	private String						toNumber;

	@Column(name = "Visable")
	private boolean						visable;

	// bi-directional many-to-one association to Answer
	@OneToMany(mappedBy = "question", fetch = FetchType.EAGER)
	private Set<Answer>					answers;

	// bi-directional many-to-one association to QuestionResponsibility
	@OneToMany(mappedBy = "question", fetch = FetchType.EAGER)
	private Set<QuestionResponsibility>	questionResponsibilities;

	public Question() {
	}

	public int getQuestionID() {
		return this.questionID;
	}

	public void setQuestionID(int questionID) {
		this.questionID = questionID;
	}

	public Long getCoreID() {
		return this.coreID;
	}

	public void setCoreID(Long coreID) {
		this.coreID = coreID;
	}

	public void setDateReceived(Date dateReceived) {
		this.dateReceived = dateReceived;
	}

	public Date getDateReceived() {
		return dateReceived;
	}

	public String getFromNumber() {
		return this.fromNumber;
	}

	public void setFromNumber(String fromNumber) {
		this.fromNumber = fromNumber;
	}

	public String getQuestion() {
		return this.question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	public String getToNumber() {
		return this.toNumber;
	}

	public void setToNumber(String toNumber) {
		this.toNumber = toNumber;
	}

	public Set<Answer> getAnswers() {
		return this.answers;
	}

	public void setAnswers(Set<Answer> answers) {
		this.answers = answers;
	}

	public Set<QuestionResponsibility> getQuestionResponsibilities() {
		return this.questionResponsibilities;
	}

	public void setQuestionResponsibilities(Set<QuestionResponsibility> questionResponsibilities) {
		this.questionResponsibilities = questionResponsibilities;
	}

	public void setVisable(boolean visable) {
		this.visable = visable;
	}

	public boolean isVisable() {
		return visable;
	}
}